export const setTime = (time) => {
  let timeStamp = new Date(time).getTime();
  let now = new Date().getTime();
  let offsetTime = now - timeStamp;
  let str = "";
  if (offsetTime > 1000 * 60 * 60 * 24 * 30) {
    str = Math.floor(offsetTime / (1000 * 60 * 60 * 24 * 30)) + " 个月前";
  } else if (
    offsetTime > 1000 * 60 * 60 * 24 &&
    offsetTime < 1000 * 60 * 60 * 24 * 30
  ) {
    str = Math.floor(offsetTime / (1000 * 60 * 60 * 24)) + " 天前";
  } else if (offsetTime < 1000 * 60 * 60 * 24 && offsetTime > 1000 * 60 * 60) {
    str = Math.floor(offsetTime / (1000 * 60 * 60)) + " 小时前";
  } else {
    str = Math.floor(offsetTime / (1000 * 60)) + " 分钟前";
  }
  return str;
};
